import { Global, Module } from '@nestjs/common';
import * as Minio from 'minio';
export const MINIO_CLIENT = 'MINIO_CLIENT';

@Global()
@Module({
    providers: [
        {
            provide: MINIO_CLIENT,
            async useFactory(...args) {
                const client = new Minio.Client({
                    endPoint: 'localhost',
                    port: 9000,
                    useSSL: false,
                    accessKey: 'GWCuYxY8s83nnaMg0OS9',
                    secretKey: 'KZeknlNxlmqqeSTZDx3dI2yIpaViCetWEXrkY21A'
                })
                return client
            },
        }
    ],
    exports: [MINIO_CLIENT]
})
export class MinioModule {}
